class Skill < ActiveRecord::Base
  has_many :userskills
  has_many :jobskills
  
  SKILLS_DISPLAY_PER_PAGE = 50
  SKILLNAME_MAX_LENGTH = 20
  SKILLNAME_SIZE = 20
  
  validates_presence_of :skillname
  validates_uniqueness_of :skillname
  validates_length_of :skillname, :maximum => SKILLNAME_MAX_LENGTH

  validates_format_of :skillname,
                      :with => /^[A-Z0-9_ ]*$/i,
                      :message => "must contain only letters, numbers, spaces, and underscores".t
  
  
  
  # Return all skills
  def self.find_all_skills
    find(:all, :order => "skillname")
  end

  def self.display_list(page)
    paginate :page => page, :per_page => SKILLS_DISPLAY_PER_PAGE, :order => "skillname"
  end
    
end
